package com.smart.chapter1;

import com.smart.chapter1.entity.MyBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

/**
 * @author cxy
 * @description java8重复注解支持
 * @date 2019年08月19 22:16:47
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
@PropertySource("classpath:/conf1.properties")
@PropertySource("classpath:/conf2.properties")
public class RepetitionAnnotationSupport {
    @Autowired
    private Environment env;

    public MyBean getBean(){
        return new MyBean(env.getProperty("app1.p1"),env.getProperty("app2.p1"));
    }

    public static void main(String[] args) {
        SpringApplication.run(RepetitionAnnotationSupport.class,args);
    }
}
